package com.yuan.gather.entity;

import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.Parameter;
import org.hibernate.annotations.Type;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 资产实体
 *
 * @author zhaoff
 */
@Getter
@Setter
@Entity
@Table(name = "tbl_asset")
public class Asset implements Serializable {

    private static final long serialVersionUID = 848756902849012590L;

    /**
     * ID
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    /**
     * 资产名称
     */
    private String name;

    /**
     * 资产IP
     */
    private String ip;

    /**
     * 资产的其他扩展属性
     */
    @Column(name = "extra")
    @Type(type = "com.yuan.gather.common.mysql.userType.JsonType")
    private Map<String, Object> extra = new HashMap<>();

    /**
     * 资产的其他扩展属性
     */
    @Column(name = "tags")
    @Type(type = "com.yuan.gather.common.mysql.userType.JsonType", parameters = {
            @Parameter(name = "type", value = "LIST"),
            @Parameter(name = "element", value = "java.lang.String")
    })
    private List<String> tags = new ArrayList<>();

}
